<template>
  <div class="documentlist_page">
    <div class="page_header">
      <div class="page_title">标签文档</div>
      <el-button type="primary" link  @click="apiUnifiedCollectionGetParentTreeNodeAll(item)">
        更多
        <el-icon><ArrowRight /></el-icon>
      </el-button>
    </div>
    <div class="page_list" v-if="labelList.length > 0">
      <div v-for="item in labelList" :key="item.id" class="table_item_box" @click="apiUnifiedCollectionGetParentTreeNodeAll(item)">
        <div class="table_item_left">
          <svg-icon :icon-class="item.icon" />
          <p>{{ item.labelName }}</p>
        </div>
        <div class="table_item_right_list" v-for="file in item.children" :key="file.id">
          <div>
            <svg-icon :icon-class="file.icon" />
            <span>{{ file.labelName }}</span>
          </div>
        </div>
      </div>
    </div>
    <el-empty v-else description="暂无数据" />

  </div>
</template>
  
  <script setup lang="ts">
import { apiFilesUserLabelQuerySys } from '@/api/enterpriseDoc/labelDocumentApi';
import { ref, onMounted, defineProps, getCurrentInstance } from 'vue';
const { proxy } = getCurrentInstance() as any;
import storage from '@/utils/local';
const props = defineProps({
  rowData: {
    type: Object,
    default() {
      return {};
    }
  }
});

/**icon转换 */
const selectSvgIcons = (v: any) => {
  return proxy.$yuUtils.selectSvgIcon(v);
};

///////////////////////////////////////// wjy
const labelList = ref<any[]>([]); // 标签列表

// 获取标签列表
const getLabelList = async () => {
  let parmas = {
    sortAsc: 'sort',
    libraryId: props.rowData.id
  };
  let res: any = await apiFilesUserLabelQuerySys(parmas);
  if (res.code == 200) {
    labelList.value = res.data;
  }
};
const apiUnifiedCollectionGetParentTreeNodeAll = (row:any) =>{
  proxy.$router.push({ path: '/newUi/enterprises/many-dimensions' });
} 
onMounted(() => {
  getLabelList();
});
</script>
  
  <style scoped lang="scss">
// 文字几行隐藏
@mixin textOverflow($clamp) {
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: $clamp; //元素几行显示
  -webkit-box-orient: vertical;
}
.page_header{
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.table_item_box {
  display: flex;
  height: 120px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 12px 0 !important;
  &:hover {
    background-color: #eff4ff;
  }
  p {
    margin: 0;
  }
  .table_item_left {
    text-align: center;
    width: 80px;
    height: 95px;
    svg {
      font-size: 30px;
    }
    p {
      font-size: 14px;
      color: #303133;
      margin-top: 8px;
      font-weight: 700;
    }
  }
  .table_item_right_list {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    height: 20px;
    margin-left: 15px;
    span {
      color: #606266;
      font-size: 14px;
      margin-left: 5px;
    }
  }
}
.documentlist_page {
  width: 100%;
  overflow: auto;
  position: absolute;
  padding: 16px;
  .page_title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
  }
  .page_list {
    width: 100%;
    // height: 570px;
    overflow: auto;
    .table_item_box {
      padding: 3px;
      // display: flex;
      // align-items: center;
      // margin-bottom: 4px;
      cursor: pointer;
      border-radius: 2px;
    }
    .realName_class {
      width: 290px;
      font-size: 14px;
      color: #444444;
      height: 17px;
      @include textOverflow(1);
    }
    .el-table {
      background-color: rgba(0, 0, 0, 0) !important;
    }
    .el-table :deep(tr) {
      background-color: rgba(0, 0, 0, 0) !important;
    }
  }
}
</style>
  